package com.group3.entity;

import java.io.Serializable;
import java.util.UUID;

public class Dish implements Serializable {
	private String dId; // 菜品id
	private String dName; // 菜品名
	private Double dPrice; // 菜品价格
	private String dImageURL; // 菜品图片
	private String mId; // 商家id
	private String pId; // 种类id

	public Dish() {
		this.dId = UUID.randomUUID().toString();
	}

	public Dish(String dName, Double dPrice, String dImageURL, String mId,
			String pId) {
		super();
		this.dId = UUID.randomUUID().toString();
		this.dName = dName;
		this.dPrice = dPrice;
		this.dImageURL = dImageURL;
		this.mId = mId;
		this.pId = pId;
	}

	public Dish(String dId, String dName, Double dPrice, String dImageURL,
			String mId, String pId) {
		super();
		this.dId = dId;
		this.dName = dName;
		this.dPrice = dPrice;
		this.dImageURL = dImageURL;
		this.mId = mId;
		this.pId = pId;
	}

	public String getdId() {
		return dId;
	}

	public void setdId(String dId) {
		this.dId = dId;
	}

	public String getdName() {
		return dName;
	}

	public void setdName(String dName) {
		this.dName = dName;
	}

	public Double getdPrice() {
		return dPrice;
	}

	public void setdPrice(Double dPrice) {
		this.dPrice = dPrice;
	}

	public String getdImageURL() {
		return dImageURL;
	}

	public void setdImageURL(String dImageURL) {
		this.dImageURL = dImageURL;
	}

	public String getmId() {
		return mId;
	}

	public void setmId(String mId) {
		this.mId = mId;
	}

	public String getpId() {
		return pId;
	}

	public void setpId(String pId) {
		this.pId = pId;
	}

	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((dId == null) ? 0 : dId.hashCode());
		result = prime * result
				+ ((dImageURL == null) ? 0 : dImageURL.hashCode());
		result = prime * result + ((dName == null) ? 0 : dName.hashCode());
		result = prime * result + ((dPrice == null) ? 0 : dPrice.hashCode());
		result = prime * result + ((mId == null) ? 0 : mId.hashCode());
		result = prime * result + ((pId == null) ? 0 : pId.hashCode());
		return result;
	}

	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Dish other = (Dish) obj;
		if (dId == null) {
			if (other.dId != null)
				return false;
		} else if (!dId.equals(other.dId))
			return false;
		if (dImageURL == null) {
			if (other.dImageURL != null)
				return false;
		} else if (!dImageURL.equals(other.dImageURL))
			return false;
		if (dName == null) {
			if (other.dName != null)
				return false;
		} else if (!dName.equals(other.dName))
			return false;
		if (dPrice == null) {
			if (other.dPrice != null)
				return false;
		} else if (!dPrice.equals(other.dPrice))
			return false;
		if (mId == null) {
			if (other.mId != null)
				return false;
		} else if (!mId.equals(other.mId))
			return false;
		if (pId == null) {
			if (other.pId != null)
				return false;
		} else if (!pId.equals(other.pId))
			return false;
		return true;
	}

	public String toString() {
		return "Dish [dId=" + dId + ", dName=" + dName + ", dPrice=" + dPrice
				+ ", dImageURL=" + dImageURL + ", mId=" + mId + ", pId=" + pId
				+ "]";
	}

}
